<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller {
	public function login(){
		$this->display();
	}


    public function dologin(){

    	$condition=array(
    		'adminname'=> $_POST['adminname'],
    		'pass'=>md5(I('post.pass'))
    		);

    	$adminMdole=M('Admin');
    	$admin=$adminMdole->where($condition)->find();

    	if ($admin) {
    		session('admin',$admin);
    		$this->redirect('Index/users');
    	}else
    	{
    		$this->error('非法登陆！');
    	}

    }
    public function logout(){
    	session('admin',null);
    //	exit();
   	    $this->redirect('login');
    }
}
